<template>
	<view class="page">
		<lexiconNavVue :title="title" />
		<view class="list">
			<view class="list-item" v-for="(item, i) in list" :key="i">
				<view class="list-item-bg">
					<view class="classname">
						<view class="title">{{ item.name }}</view>
						<view class="phone">{{ item.phone }}</view>
					</view>
					<view class="opt">
						<view class="btn" @click="handleToFace(item)">面容采集</view>
						<!-- <view class="btn">绑定微信</view> -->
					</view>
				</view>
			</view>
		</view>
		<view class="default" v-if="!list.length">- 暂未添加学生 -</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				title: '',
				grade: '',
				id: ''
			};
		},
		onLoad (options) {
			this.title = `${options.name}-学生管理`
			this.grade = options.name
			this.id = options.id
			this.getList(options.classes, options.grade)
		},
		onPullDownRefresh() {
			this.getList()
		},
		methods: {
			getList (classes, grade) {
				this.$http.getStudentByGradeClass({pageNum: 1, pageSize: 99999, gradeId: this.id}).then(res => {
					if (res.code === 200) {
						this.list = res.data.list
					}
				})
			},
			handleToFace (item) {
				uni.navigateTo({
					url: `/pages/tabbar/userCenter/facialCollection?phone=${item.phone}&userName=${item.name}&grade=${this.grade}`
				})
			}
		}
	}
</script>

<style lang="less" scoped>
.page{
	height: 100vh;
	overflow-x: hidden;
	overflow-y: auto;
	background-color: #fff8e1;
	padding: 20px
}
.list-item{
	background: linear-gradient(to bottom, #ffd16b, #fff497);
	box-shadow: 0 6px 0 0 #d9b059;
	width: 100%;
	height: 50px;
	margin-bottom: 20px;
	border-radius: 50px 10px 10px 50px;
	color: #000;
	.list-item-bg{
		height: 50px;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 20px;
		.title{
			font-family: hzgb;
			font-size: 14px;
			margin-bottom: 4px;
		}
		.phone{
			font-size: 12px;
		}
		.opt{
			display: flex;
			align-items: center;
			justify-content: flex-end;
		}
		.btn{
			background: linear-gradient(to bottom, #130e00, #373632);
			font-size: 12px;
			color: #fff;
			padding: 0 14px;
			margin-left: 6px;
			height: 28px;
			border-radius: 28px;
			line-height: 28px;
			box-shadow: 0 3px 0 0 #9b8b6f;
		}
	}
}
.default{
	color: #999;
	text-align: center;
}
</style>
